import { Component, OnInit } from '@angular/core';
import {ActivatedRoute} from "@angular/router";

@Component({
  selector: 'app-product-detail',
  templateUrl: './product-detail.component.html',
  styleUrls: ['./product-detail.component.css']
})
export class ProductDetailComponent implements OnInit {

  public productId: number | undefined
  constructor(private route: ActivatedRoute) { }

  ngOnInit(): void {
    //组件初始化完成 读取路由参数 继而根据此参数显示页面
    this.route.params.subscribe((res) => {
      this.productId = res.pid
    })
  }

}
